﻿<UserControl x:Class="YALV.View.Components.FilterPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

             xmlns:Properties="clr-namespace:YalvLib.Strings;assembly=YALVLib"

             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="300"
             >
      <Grid VerticalAlignment="Top" HorizontalAlignment="Stretch">
        <Grid.Resources>
          <Style x:Key="tbCountStyle" TargetType="TextBlock">
            <Setter Property="Margin" Value="0,3,0,0" />
            <Setter Property="FontSize" Value="11" />
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="ToolTip" Value="{x:Static Properties:Resources.MainWindow_SelectionTooltip}" />
            <Setter Property="VerticalAlignment" Value="Center" />
          </Style>
        </Grid.Resources>

        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <!-- ALL -->
      <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectAll}"
                   VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="3">
        <TextBlock Style="{StaticResource tbRbStyle}" Text="ALL" />
      </RadioButton>
        <TextBlock Style="{StaticResource tbCountStyle}" Grid.Column="2" Grid.Row="0" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right">
          <TextBlock.Text>
            <MultiBinding StringFormat="{}{0}">
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.LogEntryRowViewModels.Count" FallbackValue="0"/>
            </MultiBinding>
          </TextBlock.Text>
        </TextBlock>

        <!-- DEBUG -->
        <Border Background="{StaticResource DebugLevelColor}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="1" Padding="3" />

        <CheckBox IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.ShowLevelDebug}" Name="chkShowDebug" ToolTip="DEBUG"
                             Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,3,3,3" />
      
        <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectDebug}"
                     HorizontalAlignment="Stretch"  Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Margin="3">
        <TextBlock Style="{StaticResource tbRbStyle}" Text="DEBUG" Margin="0,3,0,0"/>
        </RadioButton>

        <TextBlock Style="{StaticResource tbCountStyle}" Grid.Column="2" Margin="3" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right">
          <TextBlock.Text>
              <MultiBinding StringFormat="{}[{0} / {1}]">
                  <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsDebugFilterCount" FallbackValue="0" />
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsDebugCount" FallbackValue="0" />
                </MultiBinding>
          </TextBlock.Text>
        </TextBlock>

        <!-- INFO -->
        <Border Background="{StaticResource InfoLevelColor}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="2" Padding="3" />

        <CheckBox IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.ShowLevelInfo}"
                  Name="chkShowInfo" ToolTip="INFO"
                  Grid.Column="0" Grid.Row="2"
                  HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,3,3,3"/>

        <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectInfo}"
                     VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="2" Margin="3">
          <TextBlock Style="{StaticResource tbRbStyle}" Text="INFO" />
        </RadioButton>
        <TextBlock Style="{StaticResource tbCountStyle}" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="2" Margin="3">
                  <TextBlock.Text>
                    <MultiBinding StringFormat="{}[{0} / {1}]">
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsInfoFilterCount" FallbackValue="0" />
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsInfoCount" FallbackValue="0" />
                    </MultiBinding>
                  </TextBlock.Text>
        </TextBlock>

        <!-- WARN -->
        <Border Background="{StaticResource WarnLevelColor}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="3" Padding="3" />

        <CheckBox IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.ShowLevelWarn}"
                  Name="chkShowWarn" ToolTip="WARN"
                  Grid.Column="0" Grid.Row="3"
                  HorizontalAlignment="Right" VerticalAlignment="Center" Margin="3" />

      <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectWarn}"
                   VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="3"  Margin="3">
        <TextBlock Style="{StaticResource tbRbStyle}" Text="WARN" />
      </RadioButton>
        <TextBlock Style="{StaticResource tbCountStyle}" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="3" Margin="3">
          <TextBlock.Text>
                <MultiBinding StringFormat="{}[{0} / {1}]">
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsWarnFilterCount" FallbackValue="0" />
                  <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsWarnCount" FallbackValue="0" />
              </MultiBinding>
          </TextBlock.Text>
        </TextBlock>

        <!-- ERROR -->
        <Border Background="{StaticResource ErrorLevelColor}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="4" Padding="3" />

        <CheckBox IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.ShowLevelError}"
                  Name="chkShowError" ToolTip="ERROR"
                  Grid.Column="0" Grid.Row="4"
                  HorizontalAlignment="Right" VerticalAlignment="Center" Margin="3"/>

        <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectError}"
                     VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="4" Margin="3">
          <TextBlock Style="{StaticResource tbRbStyle}" Text="ERROR" />
        </RadioButton>
      <TextBlock Style="{StaticResource tbCountStyle}" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="4" Margin="3">
          <TextBlock.Text>
                <MultiBinding StringFormat="{}[{0} / {1}]">
                  <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsErrorFilterCount" FallbackValue="0" />
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsErrorCount" FallbackValue="0" />
              </MultiBinding>
          </TextBlock.Text>
        </TextBlock>

        <!-- FATAL -->
        <Border Background="{StaticResource FatalLevelColor}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="5" Padding="3" />

        <CheckBox IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.ShowLevelFatal}"
                  Name="chkShowFatal" ToolTip="FATAL"
                  Grid.Column="0" Grid.Row="5"
                  HorizontalAlignment="Right" VerticalAlignment="Center" Margin="3"/>
        <RadioButton IsChecked="{Binding Path=YalvLogViewModel.LogEntryRows.SelectFatal}"
                     VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="5" Margin="3">
          <TextBlock Style="{StaticResource tbRbStyle}" Text="FATAL" Foreground="#FF80FF" />
        </RadioButton>

        <TextBlock Style="{StaticResource tbCountStyle}" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="5" Margin="3">
          <TextBlock.Text>
                <MultiBinding StringFormat="{}[{0} / {1}]">
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsFatalFilterCount" FallbackValue="0" />
                    <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.ItemsFatalCount" FallbackValue="0" />
              </MultiBinding>
          </TextBlock.Text>
        </TextBlock>

      <Label Content="Selected Sum:"
             HorizontalAlignment="Right"
             Grid.Column="1" Grid.Row="6"/>

      <TextBlock Style="{StaticResource tbCountStyle}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="6" Margin="3">
          <TextBlock.Text>
              <MultiBinding StringFormat="{}{0,10}">
                  <Binding Mode="OneWay" Path="YalvLogViewModel.LogEntryRows.LogView.Count" FallbackValue="0" />
              </MultiBinding>
          </TextBlock.Text>
      </TextBlock>

    </Grid>

    <!-- SHOW/HIDE -->
</UserControl>
